<?php
/**
 * Copyright (c) 2006, PORTALIER Julien
 * 
 * Licensed under The LGPL License
 * Redistributions of files must retain the above copyright notice.
 * 
 * @copyright    Copyright (c) 2006, Julien PORTALIER
 * @link         http://code.google.com/p/feather-cm
 * @license      http://www.opensource.org/licenses/lgpl-license.php The LGPL License
 */

class GroupsController extends AppController
{
	public $restrictActions = array('add', 'remove');
	
	function add()
	{
		$mesg = $this->Group->save() ?
			sprintf(_('Member added to group %s.'), $this->data['Group']['name']) :
			_('An error occured.');
		$this->flash($mesg);
	}
	
	function remove($member_id, $name)
	{
		$mesg = $this->Group->remove($member_id, $name) ?
			sprintf(_('Member removed from group %s.'), _($name)) :
			_('An error occured.');
		$this->flash($mesg);
	}
	
	function flash($mesg, $url=null, $code=null)
	{
		parent::flash($mesg, HTTP::getReferer(), $code);
	}
}
?>